Include clerkTraceId for backend api errors - #1894
Merged
Merged
Conversation
🦋 Changeset detectedLatest commit: 1c04f6c The changes in this PR will be included in the next version bump. This PR includes changesets to release 11 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Nikpolik
force-pushed
the
plt-155-add-traceid-to-backend-errors
branch
2 times, most recently
from
October 17, 2023 08:54
c1305f8 to
5f4fade
Compare
Nikpolik
marked this pull request as ready for review
October 17, 2023 09:34
SokratisVidros
suggested changes
Oct 17, 2023
georgepsarakis
left a comment
Contributor
There was a problem hiding this comment.
Nice work @Nikpolik 👏 !
Nikpolik
force-pushed
the
plt-155-add-traceid-to-backend-errors
branch
3 times, most recently
from
October 20, 2023 11:58
c5d6fc0 to
83f200a
Compare
Nikpolik
force-pushed
the
plt-155-add-traceid-to-backend-errors
branch
from
October 26, 2023 11:21
83f200a to
99d6b0e
Compare
SokratisVidros
approved these changes
Oct 27, 2023
Nikpolik
force-pushed
the
plt-155-add-traceid-to-backend-errors
branch
2 times, most recently
from
October 27, 2023 13:44
7dfdf84 to
16b44aa
Compare
clerkTraceId is used when available and defaults to cloudflares CF Ray id when its missing.
Nikpolik
force-pushed
the
plt-155-add-traceid-to-backend-errors
branch
from
October 30, 2023 11:40
16b44aa to
1c04f6c
Compare
Nikpolik
added this pull request to the merge queue
Oct 30, 2023
Closed
Contributor
|
@Nikpolik Could you also cherry-pick this change into |
octoper
pushed a commit
that referenced
this pull request
Oct 31, 2023
…1894) clerkTraceId is used when available and defaults to cloudflares CF Ray id when its missing.
24 tasks
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR adds
clerkTraceIdinClerkBackendApiResponse. This can help debug issues with API responses especially when errors happen server side or transiently and they can't be viewed in the console.Changes
ClerkAPIResponseErrorfrom@clerk/shared.ClerkBackendApiResponseinterface to includeclerkTraceIdwhen available.clerkTraceIdeither from backend error response or headers inbuildRequest.clerkTraceIdvalue towithLegacyReturnand then to the constructor ofClerkAPIResponseError.toStringforClerkAPIResponseErrorso it can also log the clerkTraceId.Now callining
.toString()on an error should show the trace idThe same is true for simply calling console.log on the error
Notes
DX is a bit weird here since fields that are different between success and error cannot be accessed by default in typescript and they do not appear in code completion(intelisense/language server). They can be accessed however by
checking if they exist in the object.
Checklist
npm testruns as expected.npm run buildruns as expected.Type of change
Packages affected
@clerk/clerk-js@clerk/clerk-react@clerk/nextjs@clerk/remix@clerk/types@clerk/themes@clerk/localizations@clerk/clerk-expo@clerk/backend@clerk/clerk-sdk-node@clerk/shared@clerk/fastify@clerk/chrome-extensiongatsby-plugin-clerkbuild/tooling/chore